package com.tianpengtech.admin.websitewh;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.jfinal.plugin.activerecord.Model;
import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.admin.AbstractAdmin;
import com.tianpengtech.common.model.websiteemployee.WebSiteEmployee;
import com.tianpengtech.common.model.websitewh.WebSiteWh;
import com.tianpengtech.common.search.LikeCondition;
import com.tianpengtech.common.search.QueryConstructor;

public class WebSiteWhAdminServiceImpl extends AbstractAdmin{

	@Override
	public void beforeAdd(Model<?> model) throws ValidateException {

	}

	@Override
	public void beforeQueryById(Model<?> model, int id) {

	}

	@Override
	public void beforeUpdate(Model<?> model) throws ValidateException {

	}

	@Override
	public void beforeDelete(Model<?> model) {

	}

	@Override
	public void builderSQLExpected(Model< ? > model,
			QueryConstructor queryConstruct, Map< String, Object > params) {
		String title = model.getStr(WebSiteWh.TITLE);
		if(StringUtils.isNotEmpty(title)){
			queryConstruct.and(new LikeCondition(WebSiteWh.TITLE, "%"+title+"%"));
		}
	}

	@Override
	public String tableName() {
		return WebSiteWh.dao.tableName();
	}

}